# Maintainer: Ivan Semkin (ivan at semkin dot ru)

pkgname=content-hub-git
_pkgname=content-hub
pkgver=r1509.3f04620
pkgrel=1
pkgdesc='Content sharing/picking infrastructure and service'
url='https://github.com/ubports/content-hub'
arch=(x86_64 i686 armv7h aarch64)
license=(LGPL3)
conflicts=(content-hub)
provides=(content-hub)
depends=(lcov gcovr gmock ubuntu-app-launch-git ubuntu-download-manager-git gsettings-qt apparmor libnotify ubuntu-ui-toolkit-git)
makedepends=(git cmake cmake-extras-git doxygen graphviz) 
checkdepends=(xorg-server-xvfb)
source=('git+https://github.com/ubports/content-hub.git'
        'QtArg.patch')
sha256sums=('SKIP'
            '59f927b1cda19e082fce433a852665f26e40f399433caca5fa0e7841d95d48f0')

BUILDENV+=('!check') # https://paste.ubuntu.com/p/XXm29c8rv8/

pkgver() {
  cd ${_pkgname}
  echo "r$(git rev-list --count HEAD).$(git describe --always)"
}

prepare() {
  cd ${_pkgname}
  git checkout bionic
  
  patch -Np1 -i "${srcdir}/QtArg.patch"
}

build() {
  cd ${_pkgname}
  mkdir -p /tmp/runtime-builduser
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR="lib/" -DCMAKE_INSTALL_LIBEXECDIR="lib/" .
  XDG_RUNTIME_DIR=/tmp/runtime-builduser make
}

check() {
  cd ${_pkgname}
  make ARGS+="--output-on-failure" test
}

package() {
  cd ${_pkgname}
  make DESTDIR="${pkgdir}/" install
  mv ${pkgdir}/usr/lib/qt5/ ${pkgdir}/usr/lib/qt/
}
# vim:set ts=2 sw=2 et:
